import React from 'react';
import { Dialog } from 'dw-mx-extend';
import { Button, Space } from 'dw-mx';
import ConfirmBeforeCloseChild from './ConfirmBeforeCloseChild';

export default function ConfirmBeforeClose() {
    const dialogRef = React.useRef<Dialog>();

    const openDialog1 = async () => {
        const formData = await dialogRef.current.openDialog(ConfirmBeforeCloseChild, {
            title: 'type1child',
            width: '40%',
            props: {},
        });
        alert(JSON.stringify(formData));
    };

    return (
        <>
            <Space>
                <Button onClick={openDialog1}>open</Button>
            </Space>
            <Dialog ref={dialogRef}></Dialog>
        </>
    );
}
